#pragma once

#include <QMainWindow>
#include <QSystemTrayIcon>
#include <QTimer>

QT_BEGIN_NAMESPACE
namespace Ui {
class MainWindow;
}
QT_END_NAMESPACE

class MainWindow : public QMainWindow
{
    Q_OBJECT

public:
    MainWindow(QWidget *parent = nullptr);
    ~MainWindow();

signals:
    void timedBegin();
    void timedEnd();

protected:
    void closeEvent(QCloseEvent *e) override;

private slots:
    void onActivated(QSystemTrayIcon::ActivationReason action);
    // void on_intervalMinutes_valueChanged(int mins);

    // void on_flickInterval_valueChanged(int ms);

    void on_intervalMinutes_editingFinished();

    void on_flickInterval_editingFinished();

    void on_checkAutoRun_clicked(bool checked);

private:
    void loadConfig();
    void saveConfig();

private:
    Ui::MainWindow *ui;
    QSystemTrayIcon *m_sysTrayIcon;
    QTimer *m_timer;
    QTimer *m_updateTimer;
    bool m_blink= false;
    int m_blinkCount = 0;
    QIcon m_normalIcon;
    QIcon m_grayIcon;
    QIcon m_redIcon;
    QIcon m_greenIcon;
};
